import React from 'react';
import {Link} from 'dva/router';
import { Layout,Menu, Icon } from 'antd';
const SubMenu = Menu.SubMenu;
const { Sider } = Layout;

import LinkMana from '../routes/LinkMana'

class MenuCustom extends React.Component {
  state = {
    collapsed: false,
    openKeys: [],
  }
  rootSubmenuKeys = ['sub1', 'sub2'];
  onOpenChange = (openKeys) => {
    const latestOpenKey = openKeys.find(key => this.state.openKeys.indexOf(key) === -1);
    if (this.rootSubmenuKeys.indexOf(latestOpenKey) === -1) {
      this.setState({ openKeys });
    } else {
      this.setState({
        openKeys: latestOpenKey ? [latestOpenKey] : [],
      });
    }
  }
  componentDidMount() {
  }
  render() {
    return (
        <Menu defaultSelectedKeys={[this.props.menuKey]} openKeys={this.state.openKeys} onOpenChange={this.onOpenChange} mode={"inline"} theme="dark" >
          <SubMenu key="sub1" title={<span><Icon type="mail" /><span className="nav-text">用户管理</span></span>}>
            <Menu.Item key="1">服务与动作管理</Menu.Item>
            <Menu.Item key="2">角色管理</Menu.Item>
            <Menu.Item key="3">用户列表</Menu.Item>
            <Menu.Item key="4">组织机构</Menu.Item>
          </SubMenu>
          <SubMenu key="sub2" title={<span><Icon type="link" /><span>友链</span></span>}>
            <Menu.Item key="LinkMana"><Link to={'/LinkMana'}>首页友链</Link></Menu.Item>
          </SubMenu>
        </Menu>
    );
  }
}
export default MenuCustom;
